<template>
  <div class="companyTree">
    <treeselect class="option" v-model="companyId" :options="deptOptions" placeholder="请选择所属部门" />
  </div>
</template>
<script>
  import Treeselect from "@riophae/vue-treeselect";
  import {treeselect } from "@/api/system/dept";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  export default {
    name: "company.vue",
    components:{
      Treeselect,
    },
    data() {
      return {
        treedata: [],
        defaultProps: {
          children: "children",
          label: "label"
        },
        companyId: undefined,
        deptOptions:'',
      }
    },
    created() {
      this.getTreeselect()
    },
    methods: {
      /** 查询类别下拉树结构 */
      getTreeselect() {
        treeselect().then(response => {
          this.deptOptions = response.data;
        });
      },
    }
  }
</script>

<style lang="scss">
  .companyTree{
    .option{
      width: 200px;
      height:32px;
      .vue-treeselect__control{
        line-height: 32px;
        height:32px !important;
      }
    }

  }
</style>
